package com.ydl.zhwc.mvpandrxjava.sample.token;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.ydl.zhwc.mvpandrxjava.R;
import com.ydl.zhwc.mvpandrxjava.bean.Now;
import com.ydl.zhwc.mvpandrxjava.mvp.BaseMVPActivity;

/**
 * author : Zhangwenchao
 * e-mail : zhangwch@yidianling.com
 * time   : 2017/12/22
 */

public class TokenActivity extends BaseMVPActivity<TokenContract.Presenter> implements TokenContract.View {

    private TextView tv;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sample);
        tv = findViewById(R.id.text_view);
    }

    public void onLoadClick(View view) {
        presenter.loadNow();
    }

    @Override
    protected TokenContract.Presenter createPresenter() {
        return new TokenPresenter();
    }


    @Override
    public void updateUI(Now now) {
        tv.setText(now.toString());
    }
}
